import React, {Component} from 'react';
import {
    Button,
    Dimensions,
    ListView,
    Platform,
    ScrollView,
    StyleSheet,
    Text,
    TextInput,
    View,
    Alert,
    FlatList,
    TouchableHighlight, StatusBar, Image,
} from 'react-native';

const screenWidth = Dimensions.get("window").width;
export default class GoodsDetail extends Component<Props> {
    constructor() {
        super();
    }

    back = (state, goBack) => {
        state.params.callback('this is back data');
        goBack()
    }


    render() {
        const { state, goBack} = this.props.navigation
        // let stat2e = this.setState({
        //     goback: goBack,
        //     state: state,
        //     navigation: navigation
        // })
        //页面接受值方式- {this.props.navigation.state.params.content}
        ///页面接受值方式- {navigation.getParam('content',‘-1’}
        return (
            <View style={styles.container}>
                <Text style={{flex: 1, textAlign: 'left'}}
                      onPress={() => this.back(state, goBack)}>{this.props.navigation.getParam('content', '-1')}</Text>
                <Text style={{flex: 1, textAlign: 'center'}}>你好啊</Text>
                <Text style={{flex: 1, textAlign: 'right'}}>哈哈</Text>
            </View>
        );
    }
}
const styles = StyleSheet.create({
    container: {
        width: screenWidth,
        backgroundColor: 'yellow',
        flexDirection: 'row',
        alignItems: 'center',
        paddingHorizontal: 30,
        height: 50
    }

})